home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2006 May
/
PCWMAY06.iso
/
Software
/
Freeware
/
First Page 2006 3.00
/
fp2006-final-3.00-setup.exe
/
{app}
/
Iscripts
/
Equivalents
/
roman-converter.izs
< prev
next >
Wrap
Text File
|
2005-09-28
|
6KB
|
309 lines
<!NOWIZARD>
<!TITLE>Roman Numeral Converter
<!/TITLE>
<!DESCRIPTION>This script will convert arabic numerals to roman numerals!<!/DESCRIPTION>
<!CATEGORY>Equivalents<!/CATEGORY>
<!SCRIPT>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL ROMAN NUMERAL CONVERTER:
1. Copy code into the HEAD section of document
2. Put last coding into the BODY section of document -->
<!-- STEP ONE: Add code into HEAD section of document -->
<HEAD>
<!-- Original: Ben Joffe () -->
<!-- Web Site: http://www.joffe.tk/ -->
<script>
function romanise(){
var persian=numeral.value;
var roman="";
var ronumdashes="";
var buffer=10-persian.length;
while (buffer>0) {persian="0"+persian;buffer--}
var units=new Array("","I","II","III","IV","V","VI","VII","VIII","IX");
var tens=new Array("","X","XX","XXX","XL","L","LX","LXX","LXXX","XC");
var hundreds=new Array("","C","CC","CCC","CD","D","DC","DCC","DCCC","CM");
var thousands=new Array("","M","MM","MMM","MV","V","VM","VMM","VMMM","MX");
var billionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
romandashes=billionsdashes[persian.substring(0,1)];
var hundredmillionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
romandashes+=hundredmillionsdashes[persian.substring(1,2)];
var tenmillionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
romandashes+=tenmillionsdashes[persian.substring(2,3)];
var millionsdashes=new Array("","_","__","___","_=","=","=_","=__","=___","_=");
romandashes+=millionsdashes[persian.substring(3,4)];
var hundredthousandsdashes=new Array("","_","__","___","__","_","__","___","____","__");
romandashes+=hundredthousandsdashes[persian.substring(4,5)];
var tenthousandsdashes=new Array("","_","__","___","__","_","__","___","____","__");
romandashes+=tenthousandsdashes[persian.substring(5,6)];
var thousandsdashes=new Array("","","",""," _","_","_","_","_"," _");
romandashes+=thousandsdashes[persian.substring(6,7)];
roman=thousands[persian.substring(0,1)];
roman+=hundreds[persian.substring(1,2)];
roman+=tens[persian.substring(2,3)];
roman+=thousands[persian.substring(3,4)];
roman+=hundreds[persian.substring(4,5)];
roman+=tens[persian.substring(5,6)];
roman+=thousands[persian.substring(6,7)];
roman+=hundreds[persian.substring(7,8)];
roman+=tens[persian.substring(8,9)];
roman+=units[persian.substring(9,10)];
result.innerHTML=romandashes+"<br>"+roman+"<p><a href=http://www.evrsoft.com/>http://www.evrsoft.com</a><br>by Ben Joffe";
}
</script>
</HEAD>
<!-- STEP TWO: Add code into BODY section of document -->
<BODY>
<!-- Original: Ben Joffe () -->
<!-- Web Site: http://www.joffe.tk/ -->
<p><input type="text" name=numeral size="10" onKeypress="if (event.keyCode<48 || event.keyCode>57) event.returnValue=false;" maxlength="10"><input type="button" value="Convert" onclick="romanise()"></p>
<tt id=result style=font-size:14pt>Enter a numeral into the box to have it converted into Roman Numerals
<br><br>
<!-- END OF SCRIPT -->
<!/SCRIPT>
<!PREVIEW>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL ROMAN NUMERAL CONVERTER:
1. Copy code into the HEAD section of document
2. Put last coding into the BODY section of document -->
<!-- STEP ONE: Add code into HEAD section of document -->
<HEAD>
<!-- Original: Ben Joffe () -->
<!-- Web Site: http://www.joffe.tk/ -->
<script>
function romanise(){
var persian=numeral.value;
var roman="";
var ronumdashes="";
var buffer=10-persian.length;
while (buffer>0) {persian="0"+persian;buffer--}
var units=new Array("","I","II","III","IV","V","VI","VII","VIII","IX");
var tens=new Array("","X","XX","XXX","XL","L","LX","LXX","LXXX","XC");
var hundreds=new Array("","C","CC","CCC","CD","D","DC","DCC","DCCC","CM");
var thousands=new Array("","M","MM","MMM","MV","V","VM","VMM","VMMM","MX");
var billionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
romandashes=billionsdashes[persian.substring(0,1)];
var hundredmillionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
romandashes+=hundredmillionsdashes[persian.substring(1,2)];
var tenmillionsdashes=new Array("","=","==","===","==","=","==","===","====","==");
romandashes+=tenmillionsdashes[persian.substring(2,3)];
var millionsdashes=new Array("","_","__","___","_=","=","=_","=__","=___","_=");
romandashes+=millionsdashes[persian.substring(3,4)];
var hundredthousandsdashes=new Array("","_","__","___","__","_","__","___","____","__");
romandashes+=hundredthousandsdashes[persian.substring(4,5)];
var tenthousandsdashes=new Array("","_","__","___","__","_","__","___","____","__");
romandashes+=tenthousandsdashes[persian.substring(5,6)];
var thousandsdashes=new Array("","","",""," _","_","_","_","_"," _");
romandashes+=thousandsdashes[persian.substring(6,7)];
roman=thousands[persian.substring(0,1)];
roman+=hundreds[persian.substring(1,2)];
roman+=tens[persian.substring(2,3)];
roman+=thousands[persian.substring(3,4)];
roman+=hundreds[persian.substring(4,5)];
roman+=tens[persian.substring(5,6)];
roman+=thousands[persian.substring(6,7)];
roman+=hundreds[persian.substring(7,8)];
roman+=tens[persian.substring(8,9)];
roman+=units[persian.substring(9,10)];
result.innerHTML=romandashes+"<br>"+roman+"<p><a href=http://www.evrsoft.com/>http://www.evrsoft.com</a><br>by Ben Joffe";
}
</script>
</HEAD>
<!-- STEP TWO: Add code into BODY section of document -->
<BODY>
<!-- Original: Ben Joffe () -->
<!-- Web Site: http://www.joffe.tk/ -->
<p><input type="text" name=numeral size="10" onKeypress="if (event.keyCode<48 || event.keyCode>57) event.returnValue=false;" maxlength="10"><input type="button" value="Convert" onclick="romanise()"></p>
<tt id=result style=font-size:14pt>Enter a numeral into the box to have it converted into Roman Numerals
<br><br>
<!-- END OF SCRIPT -->
<!/PREVIEW>
<!RELATED>NONE<!/RELATED>